/**
 * 功能描述
 */

define(function (require, exports, module) {
	var Component = require("grid");
	var proctrgrid = require("../constant/fetchProperties");
	var Dialog = require("dialog");
	var gridEvents = require("../handler/gridEvents");
	
    var instance = {
        initComponent: function (params, widget) {
            var grid = new Component({
            	parentNode : ".J-grid",	
            	url : "api/welfareconsumptioncoupon/queryall",
            	autoRender : false,
				params : function(){
					var subnav = widget.get("subnav");
					var obj = {
							"status":"Effective",
                			"servicePoint.pkServicePoint" : subnav.getValue("servicePoint"),
                			"flag":false,
                			fetchProperties : proctrgrid.fetchProperties
                	};
	    			return obj;
				},
				model : {
				 columns  : [{
					 name : "welfareConsumptionCoupon.cardNo",//
					 label : "卡号",
				 },{
					 name : "welfareConsumptionCoupon.travelContract.member.personalInfo.name",
					 label : "会员",
				 },{
					 name : "welfareConsumptionCoupon.travelContract.member.personalInfo.mobilePhone",
					 label : "联系电话",
				 },{
					 name : "welfareConsumptionCoupon.balance",
					 label : "余额(元)",
				 },{
					 name : "welfareConsumptionCoupon.grantDate",
					 label : "发卡日期",
					 format: "date"
				 },{
					 name : "welfareConsumptionCoupon.returnDate",
					 label : "上次返券日期",
					 format: "date"
				 },{
					 name : "welfareConsumptionCoupon.status.value",
					 label : "状态",
				 },{
						name:"show",
						label:"操作",
						format:"button",
						formatparams:[{
							id:"edit",
							icon:"icon-edit",
							text:"返券",
							handler:function(index,data,rowEle){
								gridEvents.UpDateMeter(data,widget);
							}
						}]
				 }]
				}
            });
            widget.set("grid", grid);
        }
    };
    module.exports = instance;
});
